import star from './star.png'
import PolylineImageTrailMaterialProperty from "./PolylineImageTrailMaterialProperty";

export default class Track{
    _viewer:any
    constructor(viewer){
        this._viewer=viewer
    }
    create(option){
      let viewer=this._viewer
        viewer.entities.add({
            polyline: {
              clampToGround: true,
              // positions: Cesium.Cartesian3.fromDegreesArray([
              //   110, 39, 111, 39, 111, 40, 110, 40, 110, 39,
              // ]),
              positions:option.position,
              material: new PolylineImageTrailMaterialProperty({
                color: Cesium.Color.YELLOW,
                speed: 10,
                image: star,
                repeat: { x: 50, y: 1 },
              }),
              width: 20,
            },
          });
          viewer.camera.flyTo({
            destination: new Cesium.Cartesian3(
              -1854014.9400005112,
              4925754.96615905,
              4208598.756538136
            ),
            orientation: {
              heading: 0.005342248184040166,
              pitch: -1.3759883623507303,
              roll: 0.000001,
            },
            duration: 3,
          });
 
    }
}